package com.itheima.objectstream;

import com.itheima.domain.Student;

import java.io.EOFException;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;

/*
读取文件中的对象
反序列化流
 */
public class Demo02 {

    public static void main(String[] args) throws IOException, ClassNotFoundException {
        ObjectInputStream ois = new ObjectInputStream(new FileInputStream("day13\\aaa\\student.txt"));
        while (true) {
            try {
                Student s = (Student) ois.readObject();
                System.out.println(s);
            } catch (EOFException e) {
                break;
            }
        }
        ois.close();

    }
}
